package fr.nts.application.novadmin.database.model.employe.embedded;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import fr.nts.application.novadmin.database.model.enumeration.CongeType;

/**
 * Represente les congés d'un utilisateur Novadmin.
 * 
 * @author sco
 * @version 1.0.0
 */
@Embeddable
public class Conge implements Serializable{
    
    private static final long serialVersionUID = 1L;
    
    private static final Logger log = LoggerFactory.getLogger(Conge.class);
    
    @Enumerated(EnumType.STRING)
    @Column(name = "conge_type", nullable = false)
    private CongeType congeType;
    
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "date_debut", nullable = false)
    private Date dateDebut;
    
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "date_fin", nullable = false)
    private Date dateFin;
    
    /*
     * (non-Javadoc)
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString(){
    	if(log.isDebugEnabled()){
	    	return new ToStringBuilder(this).append("congeType", congeType)
	    	                                .append("dateFin", dateFin)
	    	                                .append("dateDebut", dateDebut)
	                                        .toString();
    	}else{
    		return super.toString();
    	}
    }




    // GETTER / SETTER
	public CongeType getCongeType(){
		return congeType;
	}

	public void setCongeType(CongeType congeType){
		this.congeType = congeType;
	}

	public Date getDateDebut(){
		return dateDebut;
	}

	public void setDateDebut(Date dateDebut){
		this.dateDebut = dateDebut;
	}

	public Date getDateFin(){
		return dateFin;
	}

	public void setDateFin(Date dateFin){
		this.dateFin = dateFin;
	}
}